package com.webapp.controller;



import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;


import com.webapp.domain.LoginForm;
import com.webapp.entity.Area;
import com.webapp.service.AreaService;



@Controller
@RequestMapping("/login")
public class LoginController {
	protected static final String VIEW = "/index/";
	
//    @RequestMapping({"/",""})
//    public ModelAndView login(HttpServletRequest request,HttpServletResponse response,LoginForm command ){
//        String username = command.getUsername();
//        ModelAndView mv = new ModelAndView("/index/index","command","LOGIN SUCCESS, " + username);
//        return mv;
//    }
	
	@Autowired
	private AreaService areaService;
	
	
	@RequestMapping({"/", ""})
	public String index(LoginForm command,ModelMap model) {
//		String username = command.getUsername();
		Area area=areaService.getByCode("86");
		model.put("command", command);
		model.put("area", area);
		return VIEW + "index";
	}
    
}